package com.syq.utils;

import enums.HospitalExceptionEnums;

import java.util.HashMap;

/**
 * @ClassName: R
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/20 20:59
 */


public class R extends HashMap {

    public static R ok(){
        R r = new R();
        r.put("code",0);
        r.put("msg","");
        return r;
    }

    public static R ok(String msg){
        R r = new R();
        r.put("code",0);
        r.put("msg",msg);
        return r;
    }

    public static R error(int code,String msg){
        R r = new R();
        r.put("code",code);
        r.put("msg",msg);
        return r;
    }

    public static R error(HospitalExceptionEnums enums,String msg){
        R r = new R();
        r.put("code",enums.getCode());
        r.put("msg",enums.getMsg()+msg);
        return r;
    }
}
